<div>
    <hr>
    <div style=margin:2px>{% for menu in menus %}{% if menu.id != 0 %}
        <button onclick='updateColnumBtn("{{ menu.id }}","{{ menu.title }}-{{ menu.islabel }}-{{ menu.sort }}","{{ menu.islabel }}")'
                style=margin:4px>{{ menu.title }} [{{ menu.sort }}] （{{ menu.coun }}）
        </button>
        <a href=javascript:void(0); onclick='delColnumBtn("{{ menu.id }}")'>X</a>  {% endif %}{% endfor %}
    </div>
    <hr>
    <div style=margin:2px>{% for lable in lables %}
        <button onclick='updateColnumBtn("{{ lable.id }}","{{ lable.title }}-{{ lable.islabel }}-{{ lable.sort }}","{{ lable.islabel }}")'
                style=margin:4px>{{ lable.title }} [{{ lable.sort }}] （{{ lable.coun }}）
        </button>
        <a href=javascript:void(0); onclick='delColnumBtn("{{ lable.id }}")'>X</a> {% endfor %}
    </div>
    <hr>
    <div style=margin:8px>
        <button onclick=createColnumBtn()>添加栏目</button>
    </div>
</div>
<script>
    function switchOpen(t,l,n,o){function e(t){"ok"===t?colManage():alert("失败！")}var i;-1!=l.indexOf("-")?2===(i=l.split("-")).length?$.post(o,{id:t,title:i[0],islabel:i[1],sort:"0"},function(t){e(t)}):3===i.length&&$.post(o,{id:t,title:i[0],islabel:i[1],sort:i[2]},function(t){e(t)}):$.post(o,{id:t,title:l,islabel:n,sort:"0"},function(t){e(t)})}function createColnumBtn(){var t=prompt("新增(title-islabel-sort)","");null==t||""===t?console.log("取消输入!"):switchOpen("0",t,"0","/col/create/save/")}function updateColnumBtn(t,l,n){var o=prompt("修改(title-islabel-sort)",l);null==o||""===o?console.log("取消输入!"):switchOpen(t,o,n,"/col/update/save/")}function delColnumBtn(t){confirm("确定要删除吗？")&&$.post("/col/delete/save/",{id:t},function(t){"ok"===t?colManage():alert("失败！")})}
</script>